#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int a[N], b[N];
int n, m;	
int main()
{
	cin >> n;
	LL sum = 0;
	int idx1 = 0, idx2 = 0;
	int cnt1 = 0, cnt2 = 0;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (x % 2 == 0) {
			sum += x;
			a[idx1++] = x;
		}
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		int x;
		cin >> x;
		if (x & 1) {
			idx2++;
		}
	}
	if (idx2 >= idx1) {
		cout << 0 << endl;
		return 0;
	}
	if (!idx2) {
		cout << sum << endl;
		return 0;
	}
	if (idx1 > idx2) {
		sort(a, a + idx1);
		LL ans = 0;
		/*cout << "idx1==" << idx1 << endl;
		cout << "idx2==" << idx2 << endl;*/
		for (int i = 0; i < idx1 - idx2; i++) {
			ans = ans + 1ll * a[i];
		}
		cout << ans << endl;	
	}
	return 0;
}